var rs= "http://61.4.185.48:81/g/";
var visitor=new Cookie(document,"cityid",43800,"/","m.weather.com.cn","/");
visitor.load(); 
var std="";
var url = window.location.href; 
var start=url.indexOf("id"); 
var end=url.indexOf("T"); 
if(start!=-1){
var first=start+parseInt(3);
call = url.substring(first,end);
 res(call);
}
else{//传参开始
if(!visitor.idinfo||!visitor.date)
{
var js = document.createElement("script"); 
js.setAttribute("type", "text/javascript");
js.setAttribute("src",rs);
document.body.insertBefore(js, null);
function id_callback(){ 
std = id;
visitor.idinfo=std;
visitor.date="5";
visitor.store();
 res(std);
} 
}
else
{
std=visitor.idinfo;
res(std);
}
if(typeof(id)=="undefined"){
var id="101010100";
res(id);

}
else
{
std=visitor.idinfo;
res(std);
}
}///传参时程序结束
function res(id){
if(id==""){
str="101010100";
var datetime='/data/'+str+'.html';
}
else
{
var datetime='/data/'+id+'.html';

}

var xmlhttp=null; 
function createXMLHTTPRequext(){ 
if (window.XMLHttpRequest){
	xmlhttp = new XMLHttpRequest(); //Mozilla

	}
else if (window.ActiveXObject) {
xmlhttp =new ActiveXObject("Msxml2.XMLHTTP") ;
if (! xmlhttp ){
 xmlhttp = new ActiveXObject('Microsoft.XMLHTTP'); 
 }
}
}
var jsonobj;

function HandleStateChange() 
{
    if (xmlhttp.readyState == 4){
       var jsontext =xmlhttp.responseText;
       var func = new Function("return " + jsontext);
       jsonobj = func();
    } 
}

function PostOrder(xmldoc) 
{ 
    createXMLHTTPRequext();
    
    xmlhttp.open("GET", xmldoc,false); 
    xmlhttp.onreadystatechange= HandleStateChange;  
    xmlhttp.send(null); 


}


    var xmlhttp; 
    PostOrder(datetime);
    HandleStateChange();
    var cityname=jsonobj.weatherinfo.city;
    var id=jsonobj.weatherinfo.cityid;    
    var cityinfo1=jsonobj.weatherinfo.weather1;
    var cityinfo2=jsonobj.weatherinfo.weather2;
    var wd1=jsonobj.weatherinfo.wind1;
    var wd2=jsonobj.weatherinfo.wind2;
    var temp1=jsonobj.weatherinfo.temp1;
    var temp2=jsonobj.weatherinfo.temp2;
    var img1=jsonobj.weatherinfo.img1;
    var img2=jsonobj.weatherinfo.img2;
    var img3=jsonobj.weatherinfo.img3;
    var img4=jsonobj.weatherinfo.img4;
    var index=jsonobj.weatherinfo.index;
    var index_d=jsonobj.weatherinfo.index_d;
    var index_xc=jsonobj.weatherinfo.index_xc;
    var index_uv=jsonobj.weatherinfo.index_uv;
    var date=jsonobj.weatherinfo.date;
    var date_y=jsonobj.weatherinfo.date_y;
    var imgtitle1=jsonobj.weatherinfo.img_title1;
    var imgtitle2=jsonobj.weatherinfo.img_title2;
    var fl1=jsonobj.weatherinfo.fl1;
    var fl2=jsonobj.weatherinfo.fl2;
    var imgsingle=jsonobj.weatherinfo.img_single;
    var imgtitlesingle=jsonobj.weatherinfo.img_title_single;
    
for(var i=1;i<=document.getElementsByTagName("A").length;i++)
{
var num1="url"+i;
var bs=document.getElementById(num1).href="http://www.weather.com.cn/weather/"+id+".shtml";
}
if(document.getElementById("small1") != null)
{
	document.getElementById("small1").src="http://m.weather.com.cn/a_30x30/a"+img1+".png";
	document.getElementById("small1").title=imgtitle1;
	document.getElementById("small1").alt=imgtitle1;
}
if(document.getElementById("small2")!=null)
{
	if( img2 != '99')
	{
		document.getElementById("small2").src="http://m.weather.com.cn/a_30x30/a"+img2+".png";
		document.getElementById("small2").title=imgtitle2;
		document.getElementById("small2").alt=imgtitle2;
	}
	else
	{
		document.getElementById("small2").style.height='0px';
		document.getElementById("small2").title='';
		document.getElementById("small2").alt='';
	}
}
if(document.getElementById("small") != null) // 单天气现象的图标（小）
{
	document.getElementById("small").src="http://m.weather.com.cn/a_30x30/a"+imgsingle+".png";
	document.getElementById("small").title=imgtitlesingle;
	document.getElementById("small").alt=imgtitlesingle;
}
if((document.getElementById("big1")!=null) && (document.getElementById("big1") != '99'))
{
	document.getElementById("big1").src="http://m.weather.com.cn/img/b"+img1+".gif";
	document.getElementById("big1").title=imgtitle1;
	document.getElementById("big1").alt=imgtitle1;
}
if(document.getElementById("big2")!=null)
{
	if( img2 != '99')
	{
		document.getElementById("big2").src="http://m.weather.com.cn/img/b"+img2+".gif";
		document.getElementById("big2").title=imgtitle2;
		document.getElementById("big2").alt=imgtitle2;
	}
	else
	{
		document.getElementById("big2").style.height='0px';
		document.getElementById("big2").title='';
		document.getElementById("big2").alt='';
	}
}
if(document.getElementById("big") != null) // 单天气现象的图标（大）
{
	document.getElementById("big").src="http://m.weather.com.cn/img/b"+imgsingle+".gif";
	document.getElementById("big").title=imgtitlesingle;
	document.getElementById("big").alt=imgtitlesingle;
}
if(document.getElementById("city")!=null)
{
	document.getElementById("city").innerHTML=cityname;
}
if(document.getElementById("weather1")!=null)
{
	if( cityinfo1.length > 8 )
	{
		document.getElementById("weather1").innerHTML =cityinfo1.substr(0,7)+'...';
		document.getElementById("weather1").title = cityinfo1;
	}
	else
	{
		document.getElementById("weather1").innerHTML =cityinfo1;
	}
}

//document.getElementById("weather2").innerHTML =cityinfo2;
if(document.getElementById("temp1")!=null)
{
	document.getElementById("temp1").innerHTML =temp1;
}
//document.getElementById("temp2").innerHTML =temp2;
if(document.getElementById("wd1")!=null)
{
	if( fl1 == '小于3级' )
	{
		fl1 = '微风';
	}
	document.getElementById("wd1").innerHTML =fl1;
}
//document.getElementById("wd2").innerHTML =wd2; 
if(document.getElementById("img1")!=null)
{
	document.getElementById("img1").innerHTML =img1;
}
if(document.getElementById("img2")!=null)
{
	document.getElementById("img2").innerHTML =img2;
}
//document.getElementById("img3").innerHTML =img3;
//document.getElementById("img4").innerHTML =img4;
if(document.getElementById("index")!=null)
{
	document.getElementById("index").innerHTML =index;
}
if(document.getElementById("index_d")!=null)
{
	document.getElementById("index_d").innerHTML =index_d;
}
if(document.getElementById("index_xc")!=null)
{
	document.getElementById("index_xc").innerHTML =index_xc;
}
if(document.getElementById("index_uv")!=null)
{
	document.getElementById("index_uv").innerHTML =index_uv;
}
if(document.getElementById("date")!=null)
{
	document.getElementById("date").innerHTML =date;
}
if(document.getElementById("date_y")!=null)
{
	document.getElementById("date_y").innerHTML =date_y;
}
}

var vjAcc="";var wrUrl="http://c.wrating.com/";var wrSv=0;function vjTrack(C){var B=vjValidateTrack();if(B===false){return }var A=wrUrl+"a.gif"+vjGetTrackImgUrl(C);document.write('<div style="display:none"><img src="'+A+'" id="wrTagImage" width="1" height="1"/></div>');vjSurveyCheck()}function vjEventTrack(D){var C=vjValidateTrack();if(C===false){return }var B=wrUrl+"a.gif"+vjGetTrackImgUrl(D);var A=new Image();A.src=B;A.onload=function(){}}function vjValidateTrack(){if(document.location.protocol=="file:"){return false}if(vjAcc==""){return false}else{if(wrUrl.substr(wrUrl.length-1,1)!="/"){wrUrl+="/"}}return true}function vjGetTrackImgUrl(S){var M=0;var N="expires=Fri, 1 Jan 2038 00:00:00 GMT;";var T=document.location;var P=document.referrer.toString();var D;var H=vjGetDomainFromUrl(T);var K;var V;var Y="";var L=vjFlash();var G="";var Z="";var J="";var O=navigator.appName+" "+navigator.appVersion;var F=new Date();var X=F.getTimezoneOffset()/-60;var A=0;var U="";var R="";if(typeof (H[1])!="undefined"){V=H[1]}else{if(typeof (H[0])!="undefined"){V=H[0]}}if(P!=""){Y=vjGetKeyword(P)}else{if((O.indexOf("MSIE")>=0)&&(parseInt(O.substr(O.indexOf("MSIE")+5),4)>=5)&&(O.indexOf("Mac")==-1)&&(navigator.userAgent.indexOf("Opera")==-1)){try{document.documentElement.addBehavior("#default#homePage");if(document.documentElement.isHomePage(location.href)){P="ishomepage"}}catch(W){}}}if(navigator.cookieEnabled){M=1}if(self.screen){G=screen.width+"x"+screen.height+"x"+screen.colorDepth}else{if(self.java){var Q=java.awt.Toolkit.getDefaultToolkit().getScreenSize();G=Q.width+"x"+Q.height+"x0"}}if(navigator.language){Z=navigator.language.toLowerCase()}else{if(navigator.browserLanguage){Z=navigator.browserLanguage.toLowerCase()}else{Z="-"}}if(navigator.javaEnabled()){A=1}if(M==1){D=document.cookie;if(D.indexOf("vjuids=")<0){K=vjVisitorID();document.cookie="vjuids="+escape(K)+";"+N+";domain="+V+";path=/;"}else{K=vjGetCookie("vjuids")}if(D.indexOf("vjlast=")<0){U="30";var E=vjGetTimestamp(F.getTime()).toString();R=E+"."+E+".30"}else{var a=vjGetCookie("vjlast");var C=a.split(".");var B="";if(typeof (C[0])!="undefined"){R=C[0].toString()}else{R=vjGetTimestamp(F.getTime()).toString()}if(typeof (C[1])!="undefined"){var I=new Date(parseInt(C[1])*1000);if(I.toDateString()!=F.toDateString()){R+="."+vjGetTimestamp(F.getTime()).toString();if(parseInt(vjGetTimestamp(F.getTime())-parseInt(C[1]))/86400>30){U="2"}else{U="1"}if(typeof (C[2])!="undefined"){U+=C[2].substr(0,1)}else{U+="0"}}else{R+="."+C[1].toString();if(typeof (C[2])!="undefined"){U+=C[2]}else{U="10"}}}else{R+="."+vjGetTimestamp(F.getTime()).toString();if(typeof (C[2])!="undefined"){U+=C[2]}else{U="10"}}R+="."+U}document.cookie="vjlast="+R+";"+N+";domain="+V+";path=/;"}J="?a="+F.getTime().toString(16)+"&t=&i="+escape(K);J+="&b="+escape(T)+"&c="+vjAcc;J+="&s="+G+"&l="+Z;J+="&z="+X+"&j="+A+"&f="+escape(L);if(P!=""){J+="&r="+escape(P)+"&kw="+Y}J+="&ut="+U+"&n=";if(typeof (S)=="undefined"){J+="&js="}else{J+="&js="+escape(S)}J+="&ck="+M;return J}function vjGetTimestamp(A){return Math.round(A/1000)}function vjGetKeyword(C){var A=[["baidu","wd"],["baidu","q1"],["google","q"],["google","as_q"],["yahoo","p"],["msn","q"],["live","q"],["sogou","query"],["youdao","q"],["soso","w"],["zhongsou","w"],["zhongsou","w1"]];var B=vjGetDomainFromUrl(C.toString().toLowerCase());var D=-1;var E="";if(typeof (B[0])=="undefined"){return""}for(i=0;i<A.length;i++){if(B[0].indexOf("."+A[i][0]+".")>=0){D=-1;D=C.indexOf("&"+A[i][1]+"=");if(D<0){D=C.indexOf("?"+A[i][1]+"=")}if(D>=0){E=C.substr(D+A[i][1].length+2,C.length-(D+A[i][1].length+2));D=E.indexOf("&");if(D>=0){E=E.substr(0,D)}if(E==""){return""}else{return A[i][0]+"|"+E}}}}return""}function vjGetDomainFromUrl(E){if(E==""){return false}E=E.toString().toLowerCase();var F=[];var C=E.indexOf("//")+2;var B=E.substr(C,E.length-C);var A=B.indexOf("/");if(A>=0){F[0]=B.substr(0,A)}else{F[0]=B}var D=F[0].match(/[^.]+\.(com.cn|net.cn|gov.cn|cn|com|net|org|gov|cc|biz|info)+$/);if(D){if(typeof (D[0])!="undefined"){F[1]=D[0]}}return F}function vjVisitorID(){var A=vjHash(document.location+document.cookie+document.referrer).toString(16);var B=new Date();return A+"."+B.getTime().toString(16)+"."+Math.random().toString(16)}function vjHash(C){if(!C||C==""){return 0}var B=0;for(var A=C.length-1;A>=0;A--){var D=parseInt(C.charCodeAt(A));B=(B<<5)+B+D}return B}function vjGetCookie(D){var B=D+"=";var F=B.length;var A=document.cookie.length;var E=0;while(E<A){var C=E+F;if(document.cookie.substring(E,C)==B){return vjGetCookieVal(C)}E=document.cookie.indexOf(" ",E)+1;if(E==1){break}}return null}function vjGetCookieVal(B){var A=document.cookie.indexOf(";",B);if(A==-1){A=document.cookie.length}return unescape(document.cookie.substring(B,A))}function vjFlash(){var _flashVer="-";var _navigator=navigator;if(_navigator.plugins&&_navigator.plugins.length){for(var ii=0;ii<_navigator.plugins.length;ii++){if(_navigator.plugins[ii].name.indexOf("Shockwave Flash")!=-1){_flashVer=_navigator.plugins[ii].description.split("Shockwave Flash ")[1];break}}}else{if(window.ActiveXObject){for(var ii=10;ii>=2;ii--){try{var fl=eval("new ActiveXObject('ShockwaveFlash.ShockwaveFlash."+ii+"');");if(fl){_flashVer=ii+".0";break}}catch(e){}}}}return _flashVer}function vjSurveyCheck(){if(wrSv<=0){return }var C=new Date();var A=C.getTime();var D=Math.random(A);if(D<=parseFloat(1/wrSv)){var B=document.createElement("script");B.type="text/javascript";B.id="wratingSuevey";B.src="http://tongji.wrating.com/survey/check.php?c="+vjAcc;document.getElementsByTagName("head")[0].appendChild(B)}};